<?php
/**
 * 2021-02-04
 * 验证规则及验证消息常量
 * php5.6以上可以使用const定义数组常量，ide报错部分可忽略
 * */

namespace App\Lib\Enum;

class ValRule
{
    //登录验证
    const LOGIN = ['name' => 'required', 'password' => 'required', 'captcha' => 'required|captcha',];
    const LOGIN_MSG = ['name.required' => '请输入登录名', 'password.required' => '请输入密码', 'captcha.required' => '请输入验证码', 'captcha.captcha' => '验证码有误'];
    //验证用户
    /*const USER_STORE = ['name' => 'required|unique:user|unique:admin_user', 'real_name' => 'required', 'password' => 'required|min:6|max:13|confirmed', 'password_confirmation' => 'required|same:password', 'site_id' => 'required|integer|min:0','org_id'=>'required|integer|min:0'];
    const USER_STORE_MSG = ['name.required' => '账号必须存在', 'name.unique' => '账号已存在', 'real_name' => '请输入真实姓名', 'password.required' => '密码不能为空', 'password.min' => '密码至少6位', 'password.max' => '密码最多13位', 'password.confirmed' => '两次输入的密码不一致', 'password_confirmed' => '请再次输入密码','site_id'=>'站点编号必须是大于等于零的整数','org_id'=>'组织机构编号必须是大于等于零的整数'];*/
    const USER_STORE = ['name' => 'required|unique:user|unique:admin_user', 'real_name' => 'required', 'password' => 'required|min:6|max:13|confirmed', 'password_confirmation' => 'required|same:password', 'org_id' => 'required|integer|min:0','email'=>'required|unique:admin_user'];
    const USER_STORE_MSG = ['name.required' => '账号必须存在', 'name.unique' => '账号已存在', 'real_name' => '请输入真实姓名', 'password.required' => '密码不能为空', 'password.min' => '密码至少6位', 'password.max' => '密码最多13位', 'password.confirmed' => '两次输入的密码不一致', 'password_confirmed' => '请再次输入密码', 'org_id' => '组织机构编号必须是大于等于零的整数','email.required'=>'请输入邮箱','email.unique'=>'邮箱已存在'];
    //验证密码
    const PWD_STORE = ['password' => 'required|min:6|max:13|confirmed', 'password_confirmation' => 'required|same:password'];
    const PWD_STORE_MSG = ['password.required' => '密码不能为空', 'password.min' => '密码至少6位', 'password.max' => '密码最多13位', 'password.confirmed' => '两次输入的密码不一致', 'password_confirmed' => '请再次输入密码'];
    //验证用户状态
    const STATUS = ['id' => 'required|integer|min:1', 'is_locked' => 'required|min:0|max:1'];
    const STATUS_MSG = ['id' => '用户编号为正整数', 'is_locked' => "用户状态仅为0,1"];
    //验证用户登录初始化密码状态
    const INITPWD = ['id' => 'required|integer|min:1', 'pwd_init' => 'required|min:0|max:1'];
    const INITPWD_MSG = ['id' => '用户编号为正整数', 'pwd_init' => "修改密码状态仅为0,1"];
    //验证提交角色
    const NAME = ['name' => 'required|filled'];
    const NAME_MSG = ['name.filled' => '请给角色起个名字'];
    //验证权限添加
    const SCOPE = ['name'=>'required','display_name'=>'required'];
    const SCOPE_MSG = ['name'=>'权限名称必须存在','display_name'=>'请输入权限显示名称'];
    //验证路由名称是否存在
    const ROUTENAME = ['name'=>'required'];
    const ROUTENAME_MSG = ['name'=>'路由名称必须存在'];
    //验证菜单父栏目id
    const PARENTID = ['parent_id'=>'required|integer|min:0'];
    const PARENTID_MSG = ['parent_id'=>'父栏目id必须大于等于0'];

    //验证分配权限
    const ASSIGN_PERMISSION=['permission'=>'required|array'];
    const ASSIGN_PERMISSION_MSG=['permission'=>'权限不存在'];

    //验证分配角色
    const ASSIGN_ROLE=['roles'=>'required|array'];
    const ASSIGN_ROLE_MSG=['roles'=>'权限不存在'];

    //验证组织机构添加
    const ORG=['parent_id'=>'required|integer|min:0','name'=>'required'];
    const ORG_MSG=['parent_id'=>'父栏目id必须大于等于0','name'=>'名称必须存在'];

    //验证分类管理
    const CATEGORY=['group_id'=>'required|integer|min:0','parent_id'=>'required|integer|min:0','name'=>'required'];
    const CATEGORY_MSG=['group_id'=>'分组id必须大于等于0','parent_id'=>'父栏目id必须大于等于0','name'=>'名称必须存在'];

    //验证分类分配标签
    const CATEGORY_TAG=['course'=>'required','exam'=>'required'];
    const CATEGORY_TAG_MSG=['course'=>'请给课程分配标签','exam'=>'请给考试分配标签'];

    //验证排序
    const SORT=['id'=>'required|integer|min:0','sort'=>'required|integer|min:0'];
    const SORT_MSG=['id'=>'操作数据不存在','sort'=>'请输入排序序号'];

    //验证标签
    const TAG = ['name'=>'required'];
    const TAG_MSG = ['name'=>'标签名称必须存在'];

    //验证标签组
    const TAG_GROUP = ['name'=>'required','scope'=>'required','tag_id'=>'required'];
    const TAG_GROUP_MSG = ['name'=>'标签名称必须存在','scope'=>'请勾选适用范围','tag_id'=>'请分配标签'];
}
